package com.qk.management.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
    Integer count(@Param("name")String name,
                  @Param("subject")Integer subject,
                  @Param("target")Integer target
                  );
    List<Course> selectPage(
            @Param("name")String name,
            @Param("subject")Integer subject,
            @Param("target")Integer target,
            @Param("offset")Integer offset,
            @Param("pageSize")Integer pageSize
    );
    @Insert("insert into course(name,subject,target,create_time,update_time) values(#{name},#{subject},#{target},#{createTime},#{updateTime})")
    void insert(Course course);
    @Select("select * from course where id = #{id}")
    Course selectById(Integer id);

    void update(Course course);
    @Delete("delete from course where id = #{id}")
    void deleteById(Integer id);
    @Select("select * from course where subject = #{subject}")
    List<Course> selectBySubject(Integer subject);
    @Select("select * from course")
    List<Course> getAllCourses();
}
